import {
  Controller,
  Get,
  Post,
  Body,
  Patch,
  Param,
  Delete,
  Query,
  HttpCode,
} from '@nestjs/common';
import { UserService } from './user.service';
import { CreateUserDto } from './dto/create-user.dto';
import { UpdateUserDto } from './dto/update-user.dto';

@Controller('user')
export class UserController {
  constructor(private readonly userService: UserService) {}

  @Post('create')
  create(@Body() createUserDto) {
    return this.userService.create(createUserDto);
  }

  @Post('login')
  @HttpCode(200)
  login(@Body() res) {
    return this.userService.login(res);
  }

  @Get()
  findAll(@Query() req) {
    return this.userService.findAll(req);
  }

  @Post('update')
  update(@Body() updateUserDto) {
    return this.userService.update(updateUserDto);
  }

  @Post('delete')
  remove(@Body() data) {
    return this.userService.remove(data);
  }
}
